package cn.zhage.aimin.ai.config;

import cn.zhage.aimin.base.response.Result;
import cn.zhage.aimin.base.exception.BusinessException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/*
 *
 * @author 渣哥
 */
@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(BusinessException.class)
    public Result<?> businessException(BusinessException ex) {
        String message = ex.getMessage();
        return Result.error(message);
    }
}
